package org.domain.sigepac.Entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

@Entity
@Table(name="tb_motivo")
@DiscriminatorColumn(name="tipo",discriminatorType=DiscriminatorType.STRING)
public abstract class Motivo extends EntidadeAbstrata {

	private static final long serialVersionUID = 1612425966867462775L;

	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;


	@Column(name = "codigo", nullable = false,unique=true, length = 5)
	@NotNull
	@Length(max = 5)
	private String codigo;

	@Column(name = "nome", nullable = false, length = 100)
	@NotNull
	@Length(max = 100)
	private String nome;




	public Serializable getId() {
		// TODO Auto-generated method stub
		return id;
	}


	public String getNome() {
		return nome;
	}


	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getCodigo() {
		return codigo;
	}
	public void setCodigo(String codigo) {
		this.codigo = codigo;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return codigo.toUpperCase()+" - "+nome;
	}

}
